import {Entity} from "../../entity";
import {Alias, Column, Editor, Serialize} from "../../decorator";

//附件
export class Attachment extends Entity{

    @Alias("系统名称")
    @Serialize("auto_name")
    public auto_name: string = "";

    @Column()
    @Editor("String")
    @Alias("文件名称")
    @Serialize("origin_name")
    public origin_name: string = "";

    @Column()
    @Alias("文件类型")
    @Serialize("file_type")
    public file_type: string = "";

    @Column()
    @Alias("文件大小")
    @Serialize("file_size")
    public file_size: string = "";

    @Column()
    @Alias("相对路径")
    @Serialize("relative_path")
    public relative_path: string = "";

    @Editor("Date")
    @Alias("上传日期")
    @Column()
    @Serialize()
    public date: Date = new Date();

    constructor() {
        super();
    }

    fromJSON(obj) {
        super.fromJSON(obj);
        this.date = new Date(this.date);
    }

    toJSON(): any {
        return super.toJSON();
    }

    create() {
        super.create();
    }
}


